package com.twu.biblioteca;

import java.util.ArrayList;

public class Register {

    private ArrayList<BookRecord> bookList;
    private ArrayList<Customer> customerList;
    private ArrayList<MovieRecord> movieList;


    public Register()
    {
        bookList=new ArrayList<BookRecord>();
        customerList=new ArrayList<Customer>();
        movieList=new ArrayList<MovieRecord>();

        bookList.add(new BookRecord(new Book("123","Harry Potter","J K Rowling"),1));
        bookList.add(new BookRecord(new Book("456","Lord of the rings","J R R Tolkien"),1));
        bookList.add(new BookRecord(new Book("789","Wuthering Heights","Emily Bronte"),1));
        bookList.add(new BookRecord(new Book("999","Tintin","Herge"),0));

        customerList.add(new Customer("123-4567","abc","abc@abc.com",1234567890,"pass"));
        customerList.add(new Customer("000-0007","qwe","qwe@qwe.com",1987654321,"pass"));

        movieList.add(new MovieRecord(new Movie("IronMan","2012","abc",7),1));
        movieList.add(new MovieRecord(new Movie("Superman","2012","abc",7),1));
        movieList.add(new MovieRecord(new Movie("SpiderMan","2012","abc",7),1));
        movieList.add(new MovieRecord(new Movie("Batman","2012","abc",7),1));
    }

    public ArrayList<BookRecord> getBookList() {
        return bookList;
    }


    public ArrayList<MovieRecord> getMovieList(){ return movieList;}


    public Customer checkUser(String userId, String password) {


        for(Customer customer: customerList)
        {
            if(customer.equals(userId,password))
            {
                return customer;
            }
        }
        return null;
    }

}
